package com.example.starseas_phone.Adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.starseas_phone.Entity.Students;
import com.example.starseas_phone.Entity.Workers;
import com.example.starseas_phone.R;

import java.util.List;

public class WorkerManagelistviewAdapter extends ArrayAdapter<Workers> {

    private int id;
    private Context mcontext;

    public WorkerManagelistviewAdapter(@NonNull Context context, int resource, @NonNull List<Workers> objects) {
        super(context, resource, objects);
        id = resource;
        mcontext = context;
    }

    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        Workers workers = getItem(position);
        View view = LayoutInflater.from(parent.getContext()).inflate(id,parent,false);
        TextView worker_manage_listview_WorkerName = (TextView) view.findViewById(R.id.worker_manage_listview_WorkerName);
        TextView worker_manage_listview_WorkerSex = (TextView) view.findViewById(R.id.worker_manage_listview_WorkerSex);
        TextView worker_manage_listview_WorkerPhone = (TextView) view.findViewById(R.id.worker_manage_listview_WorkerPhone);

        worker_manage_listview_WorkerName.setText(workers.getWorkerName());
        worker_manage_listview_WorkerSex.setText(workers.getWorkerSex());
        worker_manage_listview_WorkerPhone.setText(workers.getWorkerPhone());

        return view;
    }

}
